<?php
	class Modules_Core_View_Dashboard
	{
		private $JS;
		public function __construct()
		{

			
			$this->JS=array("lib/prototype.js",
			"src/builder.js","lib/csspopup.js","tiny_mce/tiny_mce.js",
			"lib/protohover.js","lib/jquery-1.3.2.js"
			,"lib/jquery-ui-1.7.2.custom.min.js","lib/dhtmlgoodies_calendar.js");
		}
		public function draw()
		{
			$str=file_get_contents(dirname(__FILE__)."/Dashboard.html");
			$user=new Modules_Common_DB_Users($_SESSION['id']);
			
			$str=str_replace("<!=email=!>",$user->email,$str);
			$str=str_replace("<!=menu=!>",Modules_Core_View_Menu::draw(),$str);
			
			
			if(isset($_SESSION['project'])&& $_SESSION['project']!=-1)
			{
				
				$project=new Modules_Common_DB_Projects($_SESSION['project']);
				$workspace=new Modules_Common_DB_Workspace($project->workspace_id);
				$str=str_replace("<!=projectName=!>",$workspace->name.":".$project->name,$str);
				
			}
			else
				$str=str_replace("<!=projectName=!>","No project selected",$str);
			echo $str;
		}
		public function getJS()
		{
			return $this->JS;
		}
	}
	?>